<template>
	<view>
		<image :src="list[type].background" class="bjPicture"></image>
		<NavBar :isBack='true' :isRbtn='false' :title='title' @onRight="handRight"></NavBar>
		<view class="container">
			<view>
				<view class="flex titleBox" :style="{background:list[type].color}">
					<image :src="list[type].titleBj" :class="type==0?'titleBj':'titleBjBlue'"></image>
					<view class="title">{{list[type].title}}</view>
				</view>
				<view class="flex codeBox" @click="previewImage">
					<image show-menu-by-longpress="true" :src="list[type].code" class="codeImg"></image>
					<view>点击长11按识别二维码添加{{list[type].text}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import NavBar from "../../components/NavBar.vue"
	import {
		getByType
	} from '../../common/api.js'
	export default {
		components: {
			NavBar
		},
		data() {
			return {
				list: [{
					background: 'https://gfgn.oss-cn-beijing.aliyuncs.com/temp/welfareBj_1731650430453.png',
					title: '添加内部福利群,享受专属福利',
					titleBj: '../../static/index/welfareTitleBjs.png',
					code: '',
					text: '福利群',
					color: '#ffdddc'
				}, {
					background: 'https://gfgn.oss-cn-beijing.aliyuncs.com/temp/serviceBj_1731650291279.png',
					title: '添加客服微信,享受专属客服',
					titleBj: '../../static/index/serviceTitleBj.png',
					code: '',
					text: '专属客服',
					color: '#D9EBFE'
				}],
				type: 0,
				title: '内部福利群',
				status: ''
			}
		},
		onLoad(option) {
			this.type = option.type
			if (this.type != 0) {
				this.title = this.type == 0 ? '内部福利群' : '专属客服'
			}
			this.status = this.type == 0 ? 4 : 5
			this.getByType()
		},
		methods: {
			getByType() {
				// getByType(this.status).then(res => {
				// 	this.status == 4 ? this.list[0].code = res.result.cover : this.list[1].code = res.result.cover
				// })
				this.status == 4 ? this.list[0].code = uni.getStorageSync('innerCover') : this.list[1].code = uni
					.getStorageSync('innerCover')
			},
			handRight() {
				console.log("点击右边")
			},
			previewImage() {
				// 预览图片
				let url = this.status == 4 ? [this.list[0].code] : [this.list[1].code]
				uni.previewImage({
					urls: url,
					showmenu: true
				})
			}
		},
	}
</script>

<style scoped>
	.codeImg {
		width: 462rpx;
		height: 462rpx;
		border-radius: 38rpx;
		opacity: 1;
		border: 8rpx solid #cee2ff;
		margin-bottom: 24rpx;
		margin-top: 40rpx;
	}

	.codeBox {
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		flex-direction: column;
		align-items: center;
	}

	.titleBj {
		width: 208rpx;
		height: 216rpx;
		flex-shrink: 0;
		margin-top: 40rpx;

	}

	.titleBjBlue {
		width: 152rpx;
		height: 134rpx;
		margin: 34rpx 20rpx 34rpx 40rpx;
	}

	.title {
		font-size: 32rpx;
		font-weight: 700;
	}

	.titleBox {
		width: 686rpx;
		height: 212rpx;
		align-items: center;
		border-radius: 26rpx 26rpx 0 0;
		overflow: hidden;
	}

	.bjPicture {
		width: 750rpx;
		height: 1624rpx;
	}

	.container {
		position: absolute;
		width: 686rpx;
		height: 852rpx;
		opacity: 1;
		background: #ffffff;
		left: 32rpx;
		top: 200rpx;
		border-radius: 26rpx;
	}
</style>